#include "ComboTextLabel.h"
#include <QString>
//ref:
//https://qtdebug.com/qtbook-qss-border-image/
CComboTextLabel::CComboTextLabel(QWidget *parent) : QWidget(parent)
{
    m_pLiveAreaLayout = new QHBoxLayout(this);
    m_pLiveAreaLayout->setAlignment(Qt::AlignCenter);
    m_pLiveAreaLayout->setSpacing(1);
//     m_pLiveAreaLayout->setSpacing(0);
     m_pLiveAreaLayout->setMargin(0);
    this->setLayout(m_pLiveAreaLayout);

    m_pLbHead = new QLabel(this);
    m_pLbHead->setText(tr("N"));
    m_pLbHead->setStyleSheet("color:#FED636;font-size:10px;");
    m_pLbHead->setAlignment(Qt::AlignRight|Qt::AlignVCenter);
    m_pLiveAreaLayout->addWidget(m_pLbHead);

    m_pLbNumber = new QLabel(this);
    m_pLbNumber->setStyleSheet("color:#000000;background-color:#FED636;font-size:10px;border:2px solid #ff0000;border-radius: 6px;padding:0 2 0 2;");
    m_pLbNumber->setAlignment(Qt::AlignCenter);
    m_pLbNumber->setText(QString::number(99));
    m_pLiveAreaLayout->addWidget(m_pLbNumber);

    m_pLbTail = new QLabel(this);
    m_pLbTail->setText(QString::fromLocal8Bit("T MVP"));
    m_pLbTail->setStyleSheet("color:#FED636;font-size:10px;");
    m_pLbTail->setAlignment(Qt::AlignLeft|Qt::AlignVCenter);
    m_pLiveAreaLayout->addWidget(m_pLbTail);
}


void CComboTextLabel::SetText(QString text,bool isNum)
{
    if(isNum)
    {
        m_pLbNumber->show();
        m_pLbTail->show();
        m_pLbHead->setText(tr("N"));
        m_pLbNumber->setText(text);
        m_pLbTail->setText(QString::fromLocal8Bit("T MVP"));
    }
    else
    {
        m_pLbNumber->hide();
        m_pLbTail->hide();
        m_pLbHead->setText(text);
        m_pLbNumber->setText("");
        m_pLbTail->setText("");
    }
}
